<?xml version="1.0" encoding="utf-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <element name="library">
      <interleave>
        <zeroOrMore>
          <element name="book">
            <interleave>
              <element name="isbn">
                <data type="token"/>
              </element>
              <attribute name="id">
                <data type="token"/>
              </attribute>
              <attribute name="available">
                <data type="boolean"/>
              </attribute>
              <zeroOrMore>
                <element name="author">
                  <interleave>
                    <attribute name="id">
                      <data type="token"/>
                    </attribute>
                    <element name="name">
                      <data type="token"/>
                    </element>
                    <element name="born">
                      <data type="date"/>
                    </element>
                    <element name="dead">
                      <data type="date"/>
                    </element>
                  </interleave>
                </element>
              </zeroOrMore>
              <zeroOrMore>
                <element name="character">
                  <interleave>
                    <attribute name="id">
                      <data type="token"/>
                    </attribute>
                    <element name="name">
                      <data type="token"/>
                    </element>
                    <element name="born">
                      <data type="date"/>
                    </element>
                    <element name="qualification">
                      <data type="token"/>
                    </element>
                  </interleave>
                </element>
              </zeroOrMore>
              <element name="title">
                <attribute name="xml:lang">
                  <data type="language"/>
                </attribute>
                <data type="token"/>
              </element>
            </interleave>
          </element>
        </zeroOrMore>
      </interleave>
    </element>
  </start>
</grammar>
